let i = 0
let timer  = null
function syncLoop(arr, fn, ms) {
    if(timer) {
        clearTimeout(timer)
    }
    if(i < arr.length) {
        fn(arr[i])
        i++
    } else {
        return
    }
    timer = setTimeout(() => {
        syncLoop(arr, fn, ms)
    }, ms);
}

export default syncLoop